package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.anno.AutoFill;
import com.sky.enumeration.OperationType;
import com.sky.dto.CategoryPageQueryDTO;
import com.sky.entity.Category;
import org.apache.ibatis.annotations.*;

import java.util.List;


public interface CategoryMapper {
    /**
     * 分类分页查询
     * @param dto
     * @return
     */
    Page<Category> pageQuery(CategoryPageQueryDTO dto);

    /**
     * 新增分类
     * @param category
     * @return
     */
    @AutoFill(value = OperationType.INSERT)
    int save(Category category);
    /**
     * 修改分类
     * @param category
     * @return
     */
    @AutoFill(value = OperationType.UPDATE)
    int update(Category category);

    /**
     * 根据id删除分类
     * @param id
     * @return
     */
    @Delete("delete from  category where id = #{id}")
    int  deletedById(Long id);

    List<Category> list(Integer type);
}
